package com.innoking.docsys.logger.controller;


import com.innoking.docsys.log.module.LoggerVO;
import com.innoking.docsys.logger.service.LoggerService;
import com.innoking.docsys.utils.JsonToOtherUtil;
import com.innoking.docsys.utils.OtherPojo;
import com.innoking.docsys.utils.ResultObjVO;
import com.innoking.docsys.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoggerController {

    @Autowired
    LoggerService  loggerService;

    @PostMapping("/addLogger")
    public ResultObjVO  addLoggerbyType(@RequestBody String  data){

        OtherPojo pojo= JsonToOtherUtil.rtOtherPojo(data,new LoggerVO());
        LoggerVO vo=(LoggerVO) pojo.getObj();

        loggerService.addLoger(vo);

        return  ResultUtil.success();
    }
}